<template>
  <div class="login-wrap">
    <div class="login-tool">
      <div @click="handleFullScreen" class="btn-fullscreen">
        <el-tooltip
          :content="
            fullscreen == 2
              ? `取消全屏`
              : fullscreen == 1
              ? `全屏`
              : `隐藏地址栏`
          "
          effect="dark"
          placement="bottom"
        >
          <i class="el-icon-rank"></i>
        </el-tooltip>
      </div>
      <div @click="reload" class="tool-btn">
        <el-tooltip content="刷新" effect="dark" placement="bottom">
          <i class="el-icon-refresh"></i>
        </el-tooltip>
      </div>
      <div v-if="webbrowser" @click="setwindowmin" class="tool-btn">
        <el-tooltip content="最小化" effect="dark" placement="bottom">
          <i class="el-icon-minus"></i>
        </el-tooltip>
      </div>
      <div v-if="webbrowser" @click="closewindow" class="tool-btn">
        <el-tooltip content="关闭" effect="dark" placement="bottom">
          <i class="el-icon-close"></i>
        </el-tooltip>
      </div>
    </div>
    <div class="ms-login">
      <div class="ms-title" :style="{ fontSize: CfontSize }">
        {{ HospitalName }}
      </div>
      <div class="ms-title2">{{ HospitalEnName }}</div>
      <el-form
        :model="ruleForm"
        :rules="rules"
        class="ms-content"
        label-width="0px"
        ref="ruleForm"
      >
        <div v-show="autologin_dialog">
          <el-form-item v-if="areaflag">
            <el-row v-if="!selhospafterlogin">
              <el-col :span="4">
                <div class="grid-content">院&nbsp;&nbsp;&nbsp;区</div>
              </el-col>
              <el-col :span="20">
                <div class="grid-content">
                  <el-select
                    placeholder="请选择"
                    style="width: 100%"
                    v-model="selectedhis"
                    ref="lguward"
                    @keyup.enter.native="inputautofocus('lguward')"
                    @change="HisChange()"
                    filterable
                  >
                    <!-- <el-select placeholder="请选择" style="width:100%" v-model="selectedhis" ref="lguward" filterable :filter-method="hisfilterMethod" @focus="clearFilter" @keyup.enter.native="inputautofocus('lguward')" @change="HisChange()"> -->
                    <el-option
                      :key="index"
                      :label="item.name"
                      :value="item.code"
                      v-for="(item, index) in HisList"
                    ></el-option>
                    <!-- <el-option v-for="(item,index) in HisList" :key="index" :label="item.name" :value="item.code">
                                          <span style="float: left">{{ item.name }}</span>
                                          <span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span>
                                      </el-option> -->
                  </el-select>
                </div>
              </el-col>
            </el-row>
          </el-form-item>
          <el-form-item prop="userno">
            <el-row>
              <el-col :span="4">
                <div class="grid-content">用户名</div>
              </el-col>
              <el-col :span="20">
                <div class="grid-content">
                  <el-input
                    placeholder="请输入用户名"
                    v-model="ruleForm.userno"
                    ref="lguname"
                    @keyup.enter.native="inputautofocus('lguname')"
                    @change="usernochange"
                  >
                  </el-input>
                </div>
              </el-col>
            </el-row>
          </el-form-item>
          <el-form-item prop="password">
            <el-row>
              <el-col :span="4">
                <div class="grid-content">密&nbsp;&nbsp;&nbsp;码</div>
              </el-col>
              <el-col :span="20">
                <div class="grid-content">
                  <el-input
                    placeholder="请输入密码"
                    type="password"
                    v-model="ruleForm.password"
                    @keyup.enter.native="inputautofocus('lgupwd')"
                    ref="lgupwd"
                  >
                  </el-input>
                </div>
              </el-col>
            </el-row>
          </el-form-item>
          <el-form-item prop="verfcode" v-if="needVCode">
            <el-row>
              <el-col :span="4">
                <div class="grid-content">验证码</div>
              </el-col>
              <el-col :span="20">
                <div class="grid-content">
                  <el-input
                    placeholder="请输入验证码"
                    v-model="vcode"
                    @keyup.enter.native="inputautofocus('lgvcode')"
                    ref="lgvcode"
                  >
                  </el-input>
                  <div class="code" @click="refreshCode">
                    <s-identify :identifyCode="identifyCode"></s-identify>
                  </div>
                </div>
              </el-col>
            </el-row>
          </el-form-item>
          <el-form-item v-if="!loginhideusermodule">
            <!--输入用户名后不显示用户对应模块--->
            <el-row>
              <el-col :span="4">
                <div class="grid-content">系&nbsp;&nbsp;&nbsp;统</div>
              </el-col>
              <el-col :span="20">
                <div class="grid-content">
                  <el-select
                    placeholder="请选择"
                    style="width: 100%"
                    v-model="selectmodel"
                    @keyup.enter.native="inputautofocus('lgusys')"
                    ref="lgusys"
                  >
                    <el-option
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                      v-for="item in ModList"
                    ></el-option>
                  </el-select>
                </div>
              </el-col>
            </el-row>
          </el-form-item>
        </div>
        <div v-show="!autologin_dialog">
          <div
            style="font-weight: 18px; font-weight: 800; text-align: center"
            class="ms-content"
          >
            <div style="padding: 10px">系统正在自动登录……</div>
            <div style="padding: 10px">点击下方按钮可取消自动登录</div>
            <div style="padding: 10px">剩余{{ second }}秒</div>
          </div>
        </div>
        <div
          v-if="useca == '1' && loginallowcalogin == '1'"
          class="calogin-btn"
        >
          <el-button
            @click="submitForm('ruleForm')"
            type="primary"
            v-show="autologin_dialog"
            ref="btnlogin"
            >登 录</el-button
          >
          <el-button @click="caloginConfirm()" type="primary"
            >CA 登 录</el-button
          >
          <el-button @click="autologin_dialog = true" v-show="!autologin_dialog"
            >取 消 自 动 登 录</el-button
          >
        </div>
        <div v-else class="login-btn">
          <el-button
            @click="submitForm('ruleForm')"
            type="primary"
            v-show="autologin_dialog"
            ref="btnlogin"
            >登 录</el-button
          >
          <el-button @click="autologin_dialog = true" v-show="!autologin_dialog"
            >取 消 自 动 登 录</el-button
          >
        </div>
      </el-form>
    </div>
    <el-dialog
      :title="upgradePrgTitle"
      :visible.sync="prgUpgradedialog"
      width="60%"
      :show-close="false"
      :close-on-click-modal="false"
    >
      <div style="width: 100%; height: 350px; overflow: auto">
        {{ execsql }}
      </div>
    </el-dialog>
    <!--修改密码-->
    <el-dialog
      :close-on-click-modal="false"
      :visible.sync="dialogChgpwdVisible"
      title="修改密码"
      :destroy-on-close="true"
      width="400px"
      center
    >
      <div>
        <table style="width: 100%" class="table1style">
          <tr>
            <td align="center">
              工&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号
            </td>
            <td>
              <el-input type="text" v-model="pwdForm.userno" readonly>
              </el-input>
            </td>
          </tr>
          <tr>
            <td align="center">用&nbsp;&nbsp;户&nbsp;&nbsp;名</td>
            <td>
              <el-input type="text" v-model="pwdForm.username" readonly>
              </el-input>
            </td>
          </tr>
          <tr>
            <td align="center">原&nbsp;&nbsp;密&nbsp;&nbsp;码</td>
            <td>
              <el-input
                type="password"
                v-model="pwdForm.opwd"
                ref="opwd"
                @keyup.enter.native="EnterAutoFocus('opwd')"
              >
              </el-input>
            </td>
          </tr>
          <tr>
            <td align="center">新&nbsp;&nbsp;密&nbsp;&nbsp;码</td>
            <td>
              <el-input
                type="password"
                v-model="pwdForm.npwd"
                ref="npwd"
                @keyup.enter.native="EnterAutoFocus('npwd')"
                id="pwd"
              >
              </el-input>
            </td>
          </tr>
          <tr>
            <td align="center">确认密码</td>
            <td>
              <el-input
                type="password"
                v-model="pwdForm.anpwd"
                ref="anpwd"
                @keyup.enter.native="EnterAutoFocus('anpwd')"
              >
              </el-input>
            </td>
          </tr>
        </table>
      </div>
      <el-footer slot="footer" class="dialog-footer">
        <el-button @click="modifyPwd()">确定</el-button>
        <el-button @click="dialogChgpwdVisible = false">取消</el-button>
      </el-footer>
    </el-dialog>
    <!--采购中心(登录后选择采购中心)-->
    <!-- <el-dialog :close-on-click-modal="false" title="提示" :visible.sync="dialogInvOrgSelect" width="30%" :show-close="false" ref="refdialogInvOrgSelect">
          <el-form>
              <el-form-item>
                  <el-row>
                      <el-col :span="5">
                          <div class="grid-content">采购中心</div>
                      </el-col>
                      <el-col :span="19">
                          <div class="grid-content">
                              <el-select placeholder="请选择" style="width:100%" v-model="selectInvOrg" ref="lguorg">
                                  <el-option :key="item.value" :label="item.label" :value="item.value" v-for="item in OrgList">
                                      <span style="float: left">{{ item.label }}</span>
                                      <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
                                  </el-option>
                              </el-select>
                          </div>
                      </el-col>
                  </el-row>
              </el-form-item>
          </el-form>
          <span slot="footer" class="dialog-footer">
              <el-button type="primary" @click="dialogInvOrgSelectSave">确 定</el-button>
              <el-button @click="dialogInvOrgSelect = false">取 消</el-button>
          </span>
      </el-dialog> -->

    <!--用户对应院区（区域LIS模式下勾选登录后选择用户对应院区）-->
    <el-dialog
      :close-on-click-modal="false"
      title="选择院区"
      :visible.sync="dialogUserOfHospSelect"
      width="600px"
      :show-close="false"
      ref="refdialogUserOfHospSelect"
    >
      <div style="height: 400px">
        <rm-layout-top
          splitcolor="white"
          :splitwidth="5"
          :fixsize="35"
          :canDrag="false"
        >
          <template v-slot:fix>
            <div style="height: 35px; border: 1px solid #ccc; padding: 2px">
              <table style="width: 100%; font-size: 12px">
                <tr>
                  <td style="width: 70px; font-weight: 800" align="center">
                    快速查找
                  </td>
                  <td>
                    <el-input
                      v-model="UserOfHosp.UserOfHospSearchtxt"
                      style="width: 200px"
                      placeholder="医院代码|名称(双击选择|选中确定)"
                      ref="ref_uhsearchtxt"
                    ></el-input>
                  </td>
                  <td align="right">
                    <el-button @click.native="UserOfHospSave('S')"
                      >确 定</el-button
                    >
                    <el-button @click.native="UserOfHospSave('C')"
                      >取 消</el-button
                    >
                  </td>
                </tr>
              </table>
            </div>
          </template>
          <div style="height: 100%; width: 100%">
            <vxe-table
              :data.sync="UserOfHosplist"
              @current-change="UserOfHospChange"
              border
              fit
              :mouse-config="{ selected: true }"
              :edit-config="{
                trigger: 'click',
                mode: 'cell',
                showStatus: true,
                showIcon: false
              }"
              height="auto"
              header-align="center"
              highlight-current-row
              highlight-hover-row
              ref="xTable"
              resizable
              show-header-overflow="tooltip"
              show-overflow="tooltip"
              size="mini"
              stripe
              @cell-dblclick="UserOfHospSave('S')"
            >
              <vxe-table-column
                field="hospitalname"
                title="医院名称"
                width="270"
                sortable
              ></vxe-table-column>
              <vxe-table-column
                field="hospcode"
                title="医院代码"
                width="120"
                sortable
              ></vxe-table-column>
              <vxe-table-column
                field="hospitalna"
                title="医院简称"
                width="160"
                sortable
                header-align="center"
              >
              </vxe-table-column>
            </vxe-table>
          </div>
        </rm-layout-top>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import md5 from 'js-md5'
import SIdentify from '../rmcompents/login/identify'

export default {
  components: {
    SIdentify
  },
  data: function () {
    return {
      prgUpgradedialog: false,
      dialogChgpwdVisible: false,
      pwdForm: {
        userno: '',
        username: '',
        opwd: '',
        npwd: '',
        anpwd: ''
      },
      useropwd: '',
      username: '',
      execsql: '',
      sqls: '',
      defaultprg: '',
      upgradePrgTitle: '数据库版本升级中……',
      ruleForm: {
        userno: '',
        password: ''
      },
      rules: {
        userno: [{ required: true, message: '请输入用户名', trigger: 'blur' }]
        // password: [{ required: true, message: "请输入密码", trigger: "blur" }]
      },
      ModList: [],
      // OrgList: [],
      selectmodel: '',
      // selectInvOrg: "", //采购中心
      areaflag: false, //判断是否为区域LIS模式
      selhospafterlogin: false, //登录成功后才选择权限内的医院
      dialogUserOfHospSelect: false, //用户对应院区弹窗
      loginhideusermodule: false, //输入用户名后不显示用户对应模块
      // fHisList: []这个变量未被用到过，注释掉
      HisList: [],
      selectedhis: '',
      //selinvorg: "",
      //seldevorg: 1,
      auto_login_mode: '0',
      auto_login_userno: '',
      auto_login_psw: '',
      autologin_dialog: true,
      second: 0,
      macaddress: '',
      HospitalName: '云 LIS 管理系统',
      HospitalEnName: 'Sign in Cloud Laboratory Information System',
      CfontSize: '42px',
      fullscreen: 1,
      webbrowser: typeof jsObj != 'undefined',
      dialogInvOrgSelect: false,
      needVCode: false, // 需要验证码验证
      vcode: '',
      identifyCodes: '1234567890',
      identifyCode: '',
      mu: '',
      UserOfHosp: {
        //区域LIS下用户对应院区涉及数据
        UserOfHospSearchtxt: '',
        UserOfHospData: [],
        selhis: ''
      },
      useca: '',
      loginallowcalogin: '',
      caparams: {},
      autoaddzero: '0' //登录用户自动补零到几位
    }
  },
  created() {
    this.$tool.removeLocalConfig('bigmodellist')
    this.$tool.removeSession('RptPageInfo')
    this.$tool.removeSession('thisloginignorealertlist') //每次登录清空本次登录不再提醒列表
    this.$pub.runddbackclient()
    this.$pub.SetWindowStyle(false, false, false)
    this.$pub.SetInitScale()
    this.$ddldata.common_data = []
    this.$ddldata.common_dataMulti = []
    for (var i = 0; i < localStorage.length; i++) {
      var key = localStorage.key(i)
      if (key.startsWith('RMCOMDDL_')) localStorage.removeItem(key)
    }
    this.QueryHospName()
  },
  mounted() {
    this.queryAreaHospital()
    this.auto_loginOption()
    this.$nextTick(() => {
      this.$refs.lguname.focus()
    })
  },
  methods: {
    randomNum(min, max) {
      return Math.floor(Math.random() * (max - min) + min)
    },
    refreshCode() {
      this.identifyCode = ''
      this.makeCode(this.identifyCodes, 4)
    },
    makeCode(o, l) {
      this.$tool
        .request({
          url: '/ucent/login',
          method: 'post',
          data: {
            action: 'gvcode'
          }
        })
        .then((response) => {
          this.identifyCode = this.$tool.Decrypt(response.mv)
          this.mu = response.mu
        })

      // for (let i = 0; i < l; i++) {
      //     this.identifyCode += this.identifyCodes[this.randomNum(0, this.identifyCodes.length)];
      // }
      // console.log(this.identifyCode);
    },
    queryAreaHospital() {
      this.$tool
        .request({
          url: '/ucent/login',
          method: 'post',
          data: {
            action: 'queryareahospital'
          }
        })
        .then((response) => {
          this.areaflag = response.areaflag
          this.selhospafterlogin = response.selhospafterlogin == '1'
          this.loginhideusermodule = response.loginhideusermodule == '1'
          // this.fHisList = JSON.parse(JSON.stringify(response.h));
          this.HisList = JSON.parse(JSON.stringify(response.h))
          if (this.HisList.length > 0) {
            this.selectedhis = this.HisList[0].code
            let selhis = this.$tool.getLocalConfig('selectedhis')
            if (selhis && this.HisList.find((m) => m.code == selhis)) {
              this.selectedhis = selhis
            }
          }
          // this.HisChange();
        })
    },
    EnterAutoFocus(element) {
      if (element == 'opwd') {
        this.$refs.npwd.focus()
      } else if (element == 'npwd') {
        this.$refs.anpwd.focus()
      } else if (element == 'anpwd') {
        this.isnullpwd()
      }
    },
    modifyPwd() {
      if (this.pwdForm.npwd != this.pwdForm.anpwd) {
        this.$message.error('新密码和确认密码不一致，请重新输入！')
        return false
      }
      this.verifyOldPwd()
        .then(() => {
          this.$tool
            .request({
              url: '/ucent/login',
              method: 'post',
              data: {
                action: 'verifyPwdRule',
                userno: this.pwdForm.userno,
                password: this.pwdForm.npwd
              }
            })
            .then((res) => {
              if (res.flag == 99) {
                this.$message.error('登陆失败:' + res.msg)
                return false
              } else {
                this.changePwd()
              }
            })
        })
        .catch(() => {})
    },
    verifyOldPwd() {
      return new Promise((s, f) => {
        var pwd = this.$tool.Encrypt(this.pwdForm.opwd)
        this.$tool
          .request({
            url: '/ucent/login',
            method: 'post',
            data: {
              action: 'verifyOldPwd',
              userno: this.pwdForm.userno,
              password: pwd
            }
          })
          .then((res) => {
            if (res.flag != 1) {
              this.$message.error('原密码不对，请重新输入！')
              f()
            }
            s()
          })
      })
    },
    changePwd() {
      var pwd = md5('rms-' + this.pwdForm.opwd + '-rme')
      var npwd = md5('rms-' + this.pwdForm.npwd + '-rme')
      // var agnpwd = md5("rms-" + this.pwdForm.anpwd + "-rme");
      this.$tool
        .request({
          url: '/ucent/login',
          method: 'post',
          data: {
            action: 'chgpwd',
            userno: this.pwdForm.userno,
            password: pwd,
            newpassword: npwd
          }
        })
        .then((res) => {
          if (res.errcode == '1') {
            this.$message({
              message: '保存成功！',
              type: 'success'
            })
            this.dialogChgpwdVisible = false
          } else {
            this.$message.error(res.errmsg)
          }
        })
    },
    usernochange(val) {
      //小于设置的位数自动前面补零
      if (
        val &&
        val.length > 0 &&
        val != 'admin' &&
        this.autoaddzero &&
        parseInt(this.autoaddzero) > 0
      ) {
        for (
          var len = (val + '').length;
          len < parseInt(this.autoaddzero);
          len = val.length
        ) {
          val = '0' + val
        }
      }
      this.ruleForm.userno = val
    },
    inputautofocus(element) {
      if (element == 'lguname') {
        this.$refs.lgupwd.focus()
      }
      if (element == 'lgupwd') {
        this.$nextTick(() => {
          if (this.$refs.lguward) {
            this.$refs.lguward.focus()
          } else if (this.$refs.lgvcode) {
            this.$refs.lgvcode.focus()
          } else {
            this.submitForm('ruleForm')
          }
        })
      }
      if (element == 'lguward') {
        this.$refs.lguward.blur()
        if (this.$refs.lgvcode) {
          this.$refs.lgvcode.focus()
        } else {
          this.$refs.lgusys.focus()
        }
      }
      if (element == 'lgvcode') {
        this.$refs.lgvcode.blur()
        this.$refs.lgusys.focus()
      }
      if (element == 'lgusys') {
        this.$refs.lgusys.blur()
        this.submitForm('ruleForm')
      }
    },
    auto_loginOption() {
      if (typeof jsObj != 'undefined') {
        var computeInfo = jsObj.GetComputeInfo()
        var arr = computeInfo.split('\r')
        if (arr.length == 3) {
          this.macaddress = arr[0]
        }
      } else {
        this.macaddress = 'Default'
      }
      this.$tool
        .request({
          url: '/ucent/login',
          method: 'post',
          data: {
            action: 'auto_loginOption',
            macaddress: this.macaddress,
            sqlkey: 'LIS'
          }
        })
        .then((res) => {
          let option = res //JSON.parse(res.optionJson);
          this.auto_login_mode = option.auto_login_mode //是否自动登录
          this.auto_login_userno = option.auto_login_userno //自动登录账号
          this.auto_login_psw = option.auto_login_psw //自动登录密码
          this.second = Number(
            option.auto_login_time == 0 ? 10 : option.auto_login_time
          ) //自动登录延时(秒)
          this.useca = option.useca //使用CA
          this.loginallowcalogin = option.loginallowcalogin
          this.caparams = option.caparams //CA参数
          this.autoaddzero = option.autoaddzero //登录用户自动补零
          if (res.lis310multiple) {
            this.$tool.setLocalConfig('lis310multiple', res.lis310multiple)
          }
          if (res.softname || res.compname) {
            if (typeof jsObj != 'undefined') {
              jsObj.SetSoftName(res.softname, res.compname)
            }
          }
          if (res.softname) {
            this.$tool.setLocalConfig('softname', res.softname)
          } else {
            this.$tool.removeLocalConfig('softname')
          }
          if (this.auto_login_mode == '1') {
            //开启自动登录
            this.autologin_dialog = false
            this.ruleForm = {
              userno: this.auto_login_userno,
              password: this.auto_login_psw
            }
            // 倒计时
            let interval = window.setInterval(() => {
              if (--this.second <= 0) {
                if (!this.autologin_dialog) {
                  window.clearInterval(interval)
                  this.submitForm('ruleForm')
                }
              }
            }, 1000)
          } else {
            this.autologin_dialog = true
            let userno = localStorage.getItem('rm_loguser')
            if (userno != '') {
              this.$nextTick(() => {
                this.ruleForm.userno = userno
                this.ruleForm.password = ''
              })
            } else {
              if (process.env.NODE_ENV === 'development') {
                this.ruleForm.userno = 'admin'
                this.ruleForm.password = '123'
              }
            }
          }
        })
        .catch((e) => {
          console.log('error', e)
        })
    }, //登录提交
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.checkLogin()
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    calogin(caparams, operhis) {
      return new Promise((s, f) => {
        var computername = ''
        var computeInfo = jsObj.GetComputeInfo()
        var arr = computeInfo.split('\r')
        if (arr.length == 3) {
          computername = arr[2]
        }
        let chkRetjson = ''
        if (caparams.caclassname.toUpperCase() == 'RMINTERFACE.CASZT.BLLCA') {
          chkRetjson = jsObj.CALoginParas(
            caparams.caclassname,
            caparams.caparm1,
            caparams.caparm2,
            caparams.caparm3,
            caparams.caparm4,
            caparams.caparm5,
            '',
            ''
          )
        } else {
          chkRetjson = jsObj.CALoginParasEx(
            caparams.caclassname,
            caparams.caparm1,
            caparams.caparm2,
            caparams.caparm3,
            caparams.caparm4,
            caparams.caparm5,
            '',
            '',
            '1'
          )
        }
        let chkRet = JSON.parse(chkRetjson)
        if (
          chkRet.code == '-2' ||
          chkRet.code == '-1' ||
          chkRet.code == '-3' ||
          chkRet.code == '-9'
        ) {
          s({
            flag: '-1',
            msg: 'CA登录失败：' + chkRet.keyid
          })
        } else {
          if (chkRet.keyid) {
            //如果有keyid，则用keyid去找对应的用户信息
            this.$tool
              .request({
                url: '/ucent/login',
                method: 'post',
                data: {
                  action: 'getlogindata',
                  signimg: chkRet.signimg,
                  keycode: chkRet.keyid,
                  operhis: operhis,
                  computername: computername
                }
              })
              .then((res) => {
                if (res.flag == 1) {
                  s({
                    flag: '1',
                    data: res
                  })
                } else {
                  s({
                    flag: '-1',
                    msg: 'CA登录失败：' + res.msg
                  })
                }
              })
              .catch(() => {
                s({
                  flag: '-1',
                  msg: 'CA登录失败，根据CA查找人员信息时失败！'
                })
              })
          } else {
            s({
              flag: '-1',
              msg: 'CA登录失败，未找到有效的CA！'
            })
          }
        }
      })
    },
    async caloginConfirm() {
      let that = this
      var operhis = that.selectedhis
      var userno = that.ruleForm.userno
      if (!that.areaflag || !that.selhospafterlogin) {
        if (!operhis) {
          that.$alert(
            '系统没有获取到用户所属院区，请检查权限或刷新页面重试！',
            '提示'
          )
          return false
        }
      }
      let caloginerr = false
      let camsg = ''
      if (typeof jsObj != 'undefined') {
        try {
          let cares = await that.calogin(that.caparams, operhis)
          if (cares.flag != '1') {
            caloginerr = true
            camsg = cares.msg
          } else {
            if (that.areaflag && that.selhospafterlogin) {
              that
                .UserOfHospQuery()
                .then((reshospinfo) => {
                  if (reshospinfo.length == 1) {
                    //如果当前用户只有一家医院，直接登录
                    that.selectedhis = reshospinfo[0].hospcode
                    that.caloginSuccess(that, cares.data, that.selectedhis)
                  } else if (reshospinfo.length > 1) {
                    //如果当前用户属于多家医院，弹窗选择
                    that.$refs.refdialogUserOfHospSelect
                      .ShowDialog()
                      .then(() => {
                        //多选弹窗选择院区
                        that.selectedhis = that.UserOfHosp.selhis
                        that.caloginSuccess(that, cares.data, that.selectedhis)
                      })
                      .catch(() => {
                        //this.$pub.message("您没有选择院区，禁止登录！");
                      })
                  } else {
                    //如果当前用户对应医院为0，弹出提示
                    that.selectedhis = ''
                    that.$alert('当前用户没有所属医院，请联系管理员！')
                    if (userno == 'admin') {
                      that.selectedhis = '0000'
                      that.caloginSuccess(that, cares.data, that.selectedhis)
                    }
                  }
                })
                .catch((e) => {
                  that.$alert(e, '查询用户所属院区出错')
                })
            } else {
              that.caloginSuccess(that, cares.data, that.selectedhis)
            }
          }
        } catch (err) {
          caloginerr = true
          camsg = err.message
        }
      } else {
        that.$alert(
          '系统已启用CA,请在' + this.$pub.clientname + '登录！',
          '登陆失败',
          {
            confirmButtonText: '确定',
            type: 'error'
          }
        )
        return false
      }
      if (caloginerr) {
        that.$alert('CA登录失败！' + camsg, '登陆失败', {
          confirmButtonText: '确定',
          type: 'error'
        })
        return false
      }
    },
    async caloginSuccess(that, res, operhis) {
      let userno = res.userno
      try {
        that.$tool.setLocalConfig('bigmodel', that.selectmodel) //模块
        that.$tool.setLocalConfig('selectedhis', that.selectedhis) //院区代码
        that.$tool.setSession(that.$tool.selectedhis, that.selectedhis)
        let hospdata = that.HisList.find((m) => m.code == that.selectedhis)
        if (!!hospdata) that.$tool.setLocalConfig('selectedhisna', hospdata.na) //院区简称（无简称显示名称）
        that.$tool.setSession(that.$tool.loginusername, res.username)
        that.$tool.setSession(that.$tool.loginuserno, userno)
        that.$tool.setSession(that.$tool.logintoken, res.msg)
        that.$tool.setSession(that.$tool.loginutype, res.utype)
        that.$tool.setSession(that.$tool.globalparameter, res.globalparameter)
        that.$tool.setLocalConfig('webver', res.ver)
        localStorage.setItem('rm_loguser', userno)
        //跳转到默认程序
        that.defaultprg = res.defaultprg
        that.$ddldata.IsAreaMode = res.IsAreaMode
        if (typeof jsObj != 'undefined') {
          that.$pub.SetWebInfo(userno, operhis)
          that.$pub.SetInitScale()
          //启动解码
          jsObj.ReadCard('rmycmd:rundec')
        }
        try {
          // 登录成功后获取采购中心
          let org = await that.getOrgid(userno, that.selectedhis)
          if (org) {
            // 耗材采购中心
            that.$tool.setLocalConfig('selinvorg', org.invorgid)
            that.$tool.setSession('selinvorg', org.invorgid)
            // 设备采购中心
            that.$tool.setLocalConfig('seldevorg', org.devorgid)
            that.$tool.setSession('seldevorg', org.devorgid)
            // 获取到采购中心后跳转到页面
            if (!!that.defaultprg) {
              var bmodel = that.defaultprg.replace(/[0-9]/gi, '')
              let moderes = await that.$tool.request({
                url: 'ucent/syspanel',
                method: 'post',
                data: {
                  m: bmodel
                }
              })
              if (moderes) {
                that.$tool.setLocalConfig('bigmodel', moderes.m)
                that.$tool.setLocalConfig('bigmodellist', moderes.ms)
                sessionStorage.setItem(
                  'buttonpremissions',
                  JSON.stringify(moderes.buttonpremissions)
                )
                that.$router.push('/' + that.defaultprg)
              } else {
                that.$alert('获取菜单权限出错！', '错误')
              }
            } else {
              that.$router.push('/')
            }
          } else {
            that.$alert('获取采购中心出错', '提示')
          }
        } catch (err) {
          that.$alert('获取采购中心出错' + err, '提示')
        }
      } catch (e) {
        that.$alert(e, '提示')
      }
    },
    //有多个采购中心时选择采购中心
    // dialogInvOrgSelectSave() {
    //     if (!this.selectInvOrg) {
    //         this.$alert("请选择采购中心", "信息");
    //     } else {
    //         this.selinvorg = this.selectInvOrg; //赋值选择的采购中心
    //         this.checkLogin();
    //     }
    // },
    //区域LIS模式下勾选选项登录后选择医院
    UserOfHospSave(flag) {
      if (flag == 'S') {
        let row = this.UserOfHosplist.find(
          (item) => item.hospcode == this.UserOfHosp.selhis
        )
        console.log(row.hospitalna)
        if (row) this.$tool.setLocalConfig('selectedhisna', row.hospitalna) //院区简称（无简称显示名称）
        this.$refs.refdialogUserOfHospSelect.Confirm()
      } else this.$refs.refdialogUserOfHospSelect.Cancel()
    },
    UserOfHospQuery() {
      let that = this
      return new Promise((s, f) => {
        that.$tool
          .request({
            url: '/ucent/login',
            method: 'post',
            data: {
              action: 'UserOfHospQuery',
              userno: that.ruleForm.userno,
              searchtxt: that.UserOfHosp.UserOfHospSearchtxt
            }
          })
          .then((res) => {
            that.UserOfHosp.UserOfHospData = res.data
            s(res.data)
          })
          .catch((e) => {
            f(e)
          })
      })
    },
    //用户对应院区选择（单击后点击确定）
    UserOfHospChange({ row, column }) {
      console.log('进入')
      this.UserOfHosp.selhis = row.hospcode
    }, //校验登录信息
    checkLogin() {
      let that = this
      let computername = ''
      if (typeof jsObj != 'undefined') {
        var computeInfo = jsObj.GetComputeInfo()
        var arr = computeInfo.split('\r')
        console.log(arr)
        if (arr.length == 3) {
          computername = arr[2]
        }
      }
      var userno = that.ruleForm.userno
      // var pwd = md5("rms-" + that.ruleForm.password + "-rme");
      var pwd = that.$tool.Encrypt(that.ruleForm.password)
      var opertype = that.selectmodel //这个实际没有用到
      var operhis = that.selectedhis
      // console.log("operhis");
      if (!that.areaflag || !that.selhospafterlogin) {
        if (!operhis) {
          that.$alert(
            '系统没有获取到用户所属院区，请检查权限或刷新页面重试！',
            '提示'
          )
          return false
        }
      }
      //统一放到函数loginSuccess()里面
      //    that.$tool.setLocalConfig("bigmodel", that.selectmodel); //模块
      //     that.$tool.setLocalConfig("selectedhis", that.selectedhis); //院区
      //     that.$tool.setSession(that.$tool.selectedhis, that.selectedhis);
      // that.$tool.setLocalConfig("selinvorg", that.selinvorg);
      // that.$tool.setSession("selinvorg", that.selinvorg);
      //区域LIS模式下且勾选选项登录后再选择医院，operhis不做验证
      that.$tool
        .request({
          url: '/ucent/login',
          method: 'post',
          data: {
            action: 'login',
            userno: userno,
            password: pwd,
            opertype: opertype,
            operhis: operhis,
            vcode: that.vcode,
            mu: that.mu,
            computername: computername
          }
        })
        .then((res) => {
          if (res.flag == 1) {
            if (that.areaflag && that.selhospafterlogin) {
              that
                .UserOfHospQuery()
                .then((reshospinfo) => {
                  if (reshospinfo.length == 1) {
                    //如果当前用户只有一家医院，直接登录
                    that.selectedhis = reshospinfo[0].hospcode
                    that.loginSuccess(that, res, userno, that.selectedhis)
                  } else if (reshospinfo.length > 1) {
                    //如果当前用户属于多家医院，弹窗选择
                    that.$refs.refdialogUserOfHospSelect
                      .ShowDialog()
                      .then(() => {
                        //多选弹窗选择院区
                        that.selectedhis = that.UserOfHosp.selhis
                        that.loginSuccess(that, res, userno, that.selectedhis)
                      })
                      .catch(() => {
                        //this.$pub.message("您没有选择院区，禁止登录！");
                      })
                  } else {
                    //如果当前用户对应医院为0，弹出提示
                    that.selectedhis = ''
                    that.$alert('当前用户没有所属医院，请联系管理员！')
                    if (userno == 'admin') {
                      that.selectedhis = '0000'
                      that.loginSuccess(that, res, userno, that.selectedhis)
                    }
                  }
                })
                .catch((e) => {
                  that.$alert(e, '查询用户所属院区出错')
                })
            } else {
              that.loginSuccess(that, res, userno, that.selectedhis)
            }
          } else if (res.flag == 99) {
            that.$alert(res.msg, '登陆失败', {
              confirmButtonText: '确定',
              type: 'error',
              callback: (action) => {
                that.pwdForm.userno = userno
                that.pwdForm.username = res.username
                that.useropwd = res.upwd
                that.dialogChgpwdVisible = true
                setTimeout(() => {
                  that.$refs.opwd.focus()
                }, 5)
              }
            })
            return false
          } else if (res.flag == 98) {
            that.$message.error('请输入正确的验证码！')
            that.vcode = ''
            that.refreshCode()
          } else {
            that.$refs.lguname.focus()
            that.$alert(res.msg, '登陆失败', {
              confirmButtonText: '确定',
              type: 'error'
            })
            return false
          }
        })
        .catch((e) => {
          console.log('登录异常', e)
          that.$alert('登录失败，登录过程发生异常', '登陆失败', {
            confirmButtonText: '确定',
            type: 'error'
          })
          return false
        })
    },
    //登录成功的操作放到一个函数里面
    async loginSuccess(that, res, userno, operhis) {
      try {
        that.$tool.setLocalConfig('bigmodel', that.selectmodel) //模块
        that.$tool.setLocalConfig('selectedhis', that.selectedhis) //院区代码
        that.$tool.setSession(that.$tool.selectedhis, that.selectedhis)
        let hospdata = that.HisList.find((m) => m.code == that.selectedhis)
        if (!!hospdata) that.$tool.setLocalConfig('selectedhisna', hospdata.na) //院区简称（无简称显示名称）
        that.$tool.setSession(that.$tool.loginusername, res.username)
        that.$tool.setSession(that.$tool.loginuserno, userno)
        that.$tool.setSession(that.$tool.logintoken, res.msg)
        that.$tool.setSession(that.$tool.loginutype, res.utype)
        that.$tool.setSession(that.$tool.globalparameter, res.globalparameter)
        that.$tool.setLocalConfig('webver', res.ver)
        localStorage.setItem('rm_loguser', that.ruleForm.userno)
        //  localStorage.setItem("rm_logpwd", that.ruleForm.password);
        //跳转到默认程序
        that.defaultprg = res.defaultprg
        that.$ddldata.IsAreaMode = res.IsAreaMode
        let caloginerr = false
        let camsg = ''
        if (res.useca == '1') {
          if (typeof jsObj != 'undefined') {
            try {
              let cares = await that.$ca.login(
                res.caparams,
                res.hiscode2,
                userno,
                res.allowbindingcabyself,
                res.username,
                res.multipleca_flag
              )
              if (cares.flag != '1') {
                caloginerr = true
                camsg = cares.msg
              }
            } catch (err) {
              caloginerr = true
              camsg = err.message
            }
          } else {
            that.$alert(
              '系统已启用CA,请在' + this.$pub.clientname + '登录！',
              '登陆失败',
              {
                confirmButtonText: '确定',
                type: 'error'
              }
            )
            return false
          }
        }
        if (caloginerr) {
          that.$alert('CA登录失败！' + camsg, '登陆失败', {
            confirmButtonText: '确定',
            type: 'error'
          })
          return false
        }
        if (typeof jsObj != 'undefined') {
          that.$pub.SetWebInfo(userno, operhis)
          that.$pub.SetInitScale()
          //启动解码
          jsObj.ReadCard('rmycmd:rundec')
        }
        try {
          //登录成功后获取采购中心
          let org = await that.getOrgid(userno, that.selectedhis)
          if (org) {
            // 耗材采购中心
            that.$tool.setLocalConfig('selinvorg', org.invorgid)
            that.$tool.setSession('selinvorg', org.invorgid)
            // 设备采购中心
            that.$tool.setLocalConfig('seldevorg', org.devorgid)
            that.$tool.setSession('seldevorg', org.devorgid)
            //获取到采购中心后跳转到页面
            if (!!that.defaultprg) {
              var bmodel = that.defaultprg.replace(/[0-9]/gi, '')
              // console.log("bmodel", bmodel);
              let moderes = await that.$tool.request({
                url: 'ucent/syspanel',
                method: 'post',
                data: {
                  m: bmodel
                }
              })
              if (moderes) {
                that.$tool.setLocalConfig('bigmodel', moderes.m)
                that.$tool.setLocalConfig('bigmodellist', moderes.ms)
                sessionStorage.setItem(
                  'buttonpremissions',
                  JSON.stringify(moderes.buttonpremissions)
                )
                that.$router.push('/' + that.defaultprg)
              } else {
                that.$alert('获取菜单权限出错！', '错误')
              }
            } else {
              that.$router.push('/')
            }
          } else {
            that.$alert('获取采购中心出错', '提示')
          }
        } catch (err) {
          that.$alert('获取采购中心出错' + err, '提示')
        }
      } catch (e) {
        that.$alert(e, '提示')
      }

      //执行sql升级脚本
      //that.upgradeexec(200000);
    },

    getOrgid(userno, hospcode) {
      return this.$tool.request({
        url: '/ucent/login',
        method: 'post',
        data: {
          action: 'getOrgid',
          userno: userno,
          hospcode: hospcode
        }
      })
    },
    upgradeexec(timeo) {
      this.$tool
        .request({
          url: '/ucent/upgrade',
          method: 'post',
          timeout: timeo,
          data: {
            action: 'LoginUpdb'
          }
        })
        .then((res) => {
          if (res.errcode == '1') {
            console.log('LoginUpdb', res)
            let minVer = res.minVer
            let maxVer = res.maxVer
            if (maxVer > 0) {
              if (res.curVersion < res.setVersion) {
                this.sqls = res.sqls
                this.prgUpgradedialog = true
                this.execsql = '开始升级程序！'
                this.updbver(minVer, maxVer, timeo)
              } else {
                //无需升级直接进入页面
                this.startPage()
              }
            } else {
              //无需升级直接进入页面
              this.startPage()
            }
          }
        })
        .catch((e) => {
          console.log('upgradeerror', e)
        })
    },
    updbver(minVer, maxVer, timeo) {
      let dbv = minVer
      this.$tool
        .request({
          url: '/ucent/upgrade',
          method: 'post',
          timeout: timeo,
          data: {
            action: 'LoginUpgradeSql',
            cver: dbv
          }
        })
        .then((res) => {
          if (res.errcode == '1') {
            this.upgradePrgTitle =
              '数据库版本升级中……，当前版本号【' +
              dbv +
              '】/最新版本号【' +
              maxVer +
              '】'
            this.execsql = this.sqls[dbv].m_StringValue
            dbv = dbv + 1
            if (dbv > maxVer) {
              //全部执行完成
              this.execsql = '开始修复视图！'
              this.updbview(0, timeo)
            } else {
              this.updbver(dbv, maxVer, timeo)
            }
          } else {
            //脚本执行出错
            this.startPage()
          }
        })
        .catch((e) => {
          this.startPage()
        })
    },
    updbview(dbv, timeo) {
      this.$tool
        .request({
          url: '/ucent/upgrade',
          method: 'post',
          timeout: timeo,
          data: {
            action: 'LoginUpgradeView',
            dbv: dbv
          }
        })
        .then((res) => {
          dbv = dbv + 1
          this.upgradePrgTitle = '数据库视图修复中……'
          if (res.errcode == '1') {
            this.execsql = res.execsql
            this.updbview(dbv, timeo)
          } else {
            //这里可能暂时这样，后面可能要返回升级失败的消息
            this.execsql = '程序升级完成！'
            this.startPage()
          }
        })
        .catch((e) => {
          this.execsql = '程序升级出错！' + e
          this.startPage()
        })
    },
    startPage() {
      setTimeout(() => {
        this.prgUpgradedialog = false
        if (this.defaultprg != '') {
          this.$router.push('/' + this.defaultprg)
        } else {
          this.$router.push('/')
        }
      }, 1000)
    },
    // hisfilterMethod(val) {
    //     if (!val) {
    //         this.HisList = JSON.parse(JSON.stringify(this.fHisList));
    //     } else {
    //         this.HisList = this.fHisList.filter(item => item.code.toUpperCase().indexOf(val.toUpperCase()) > -1 || item.name.toUpperCase().indexOf(val.toUpperCase()) > -1)
    //     }
    // },
    // clearFilter() {
    //     this.HisList = JSON.parse(JSON.stringify(this.fHisList));
    // },
    HisChange() {
      this.selectmodel = ''
      //this.$tool.removeLocalConfig("bigmodel");//注释掉保持退出登录后的系统为上一次选中的系统
      this.$tool
        .request({
          url: 'ucent/login',
          method: 'post',
          data: {
            action: 'Changemodel',
            his: this.selectedhis,
            userno: this.ruleForm.userno
          }
        })
        .then((response) => {
          this.ModList = response.m
          if (this.ModList && this.ModList.length > 0) {
            this.selectmodel = this.ModList[0].code
            let bigmodel = this.$tool.getLocalConfig('bigmodel')
            if (bigmodel && this.ModList.find((m) => m.code == bigmodel)) {
              this.selectmodel = bigmodel
            }
          }
        })
    },
    QueryHospName() {
      this.$tool
        .request({
          url: 'ucent/login',
          method: 'post',
          data: {
            action: 'loginname'
          }
        })
        .then((response) => {
          if (response.errcode == '1') {
            if (response.cname) {
              var size = Math.round(460 / response.cname.length)
              if (size > 42) size = 42
              this.CfontSize = size + 'px'
              this.HospitalName = response.cname
            }
            if (response.ename) {
              this.HospitalEnName = response.ename
            }
            if (response.needVcode) {
              this.needVCode = response.needVcode == '1'
              if (this.needVCode) {
                this.identifyCode = ''
                this.makeCode(this.identifyCodes, 4)
              }
            }
            //消息提醒设置
            if (response.noticemsgsetting)
              this.$bus.$emit('getmsgsetting', response.noticemsgsetting)
          }
        })
    },
    reload() {
      location.reload()
    },
    closewindow() {
      if (typeof jsObj != 'undefined') {
        jsObj.CloseWindow()
      }
    },
    // 全屏事件
    handleFullScreen() {
      if (typeof jsObj != 'undefined') {
        if (this.fullscreen == 0) {
          this.$pub.SetWindowStyle(false, false, false)
          this.fullscreen = 1
        } else if (this.fullscreen == 1) {
          this.$pub.SetWindowStyle(false, false, true)
          this.fullscreen = 2
        } else if (this.fullscreen == 2) {
          this.$pub.SetWindowStyle(true, true, false)
          this.fullscreen = 0
        }
      } else {
        let element = document.documentElement
        if (this.fullscreen == 2) {
          if (document.exitFullscreen) {
            document.exitFullscreen()
          } else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen()
          } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen()
          } else if (document.msExitFullscreen) {
            document.msExitFullscreen()
          }
          this.fullscreen = 1
        } else {
          if (element.requestFullscreen) {
            element.requestFullscreen()
          } else if (element.webkitRequestFullScreen) {
            element.webkitRequestFullScreen()
          } else if (element.mozRequestFullScreen) {
            element.mozRequestFullScreen()
          } else if (element.msRequestFullscreen) {
            // IE11
            element.msRequestFullscreen()
          }
          this.fullscreen = 2
        }
      }
    },
    setwindowmin() {
      if (typeof jsObj != 'undefined') {
        jsObj.SetWindowMin()
      } else {
        this.$alert('请使用' + this.$pub.clientname + '打开系统', '错误', {
          confirmButtonText: '确定'
        })
      }
    }
  },
  watch: {
    UName: function (val) {
      // this.$tool
      //     .request({
      //         url: "ucent/login",
      //         method: "post",
      //         data: {
      //             action: "lgmodel",
      //             userno: val,
      //         },
      //     })
      //     .then((response) => {
      //         // this.ModList = response.m;
      //         // if (this.ModList.length > 0) {
      //         //     this.selectmodel = this.ModList[0].code;
      //         //     let bigmodel = this.$tool.getLocalConfig("bigmodel");
      //         //     //console.log("bigmodel", bigmodel);
      //         //     if (bigmodel && this.ModList.find(m => m.code == bigmodel)) {
      //         //         this.selectmodel = bigmodel;
      //         //     }
      //         // }
      //         // this.fHisList = JSON.parse(JSON.stringify(response.h));
      //         // this.HisList = JSON.parse(JSON.stringify(response.h));
      //         // if (this.HisList.length > 0) {
      //         //     this.selectedhis = this.HisList[0].code;
      //         //     let selhis = this.$tool.getLocalConfig("selectedhis");
      //         //     if (selhis && this.HisList.find((m) => m.code == selhis)) {
      //         //         this.selectedhis = selhis;
      //         //     }
      //         // }
      //         this.HisChange();
      //     });
      //上面的代码已经不需要了
      if (!this.loginhideusermodule) {
        this.HisChange()
      }
    },
    dialogUserOfHospSelect(openflag) {
      if (openflag) {
        setTimeout(() => {
          if (this.$refs.ref_uhsearchtxt) this.$refs.ref_uhsearchtxt.focus()
        }, 10)
      }
    }
  },
  computed: {
    UName: function () {
      return this.ruleForm.userno
    },

    UserOfHosplist() {
      let filterName = this.UserOfHosp.UserOfHospSearchtxt.trim()
      if (filterName) {
        let rest = this.UserOfHosp.UserOfHospData.filter((item) => {
          return (
            (!!item.hospitalname
              ? item.hospitalname
                  .toUpperCase()
                  .indexOf(filterName.toUpperCase()) > -1
              : false) ||
            (!!item.hospcode
              ? item.hospcode.toUpperCase().indexOf(filterName.toUpperCase()) >
                -1
              : false)
          )
        })
        return rest
      } else {
        return this.UserOfHosp.UserOfHospData
      }
    }
  }
}
</script>

<style scoped>
::v-deep  .el-button--primary {
  background-color: #68c2e4;
}
::v-deep  .el-input__inner {
  border: 1px solid #9da5b9;
}
::v-deep  .el-input__inner:hover {
  border-color: #1476a5 !important;
}
.grid-content {
  font-size: 16px;
}
.login-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(
      to right,
      rgba(0, 0, 0, 0),
      rgba(0, 0, 0, 1)
    ),
    url(../../assets/img/login-bg4.jpg);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: top left;
}
.login-tool {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 999;
  display: flex;
  line-height: 30px;
}
.login-tool i {
  color: #e0e0e0;
}
.btn-fullscreen {
  transform: rotate(45deg);
  font-size: 20px;
}
.tool-btn,
.btn-fullscreen {
  font-size: 20px;
  width: 30px;
  text-align: center;
  margin-left: 20px;
  cursor: pointer;
}
.ms-title {
  width: 100%;
  line-height: 80px;
  height: 65px;
  text-align: center;
  font-size: 42px;
  color: #1476a5;
}
.ms-title2 {
  width: 100%;
  line-height: 30px;
  height: 10px;
  text-align: center;
  font-size: 14px;
  color: #1476a5;
}
.ms-login {
  position: absolute;
  left: 75%;
  top: 50%;
  width: 480px;
  margin: -190px 0 0 -240px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.8);
  overflow: hidden;
}
.ms-content {
  padding: 30px 60px 18px 60px;
}
.login-btn {
  text-align: center;
}
.login-btn button {
  width: 100%;
  height: 36px;
  margin-bottom: 10px;
}
.calogin-btn {
  text-align: center;
}
.calogin-btn button {
  width: 45%;
  height: 36px;
  margin-bottom: 10px;
}
.login-tips {
  font-size: 12px;
  line-height: 30px;
  color: #fff;
}
.table1style tr td {
  padding: 3px 2px 3px 5px;
}
.code {
  line-height: normal;
}
</style>
